<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateSiteLocationMallTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('site_location_mall', function (Blueprint $table) {
            $table->id();
            $table->string('mallId', 20)->default('')->comment('商场ID');
            $table->string('mallName', 120)->default('')->comment('商场名称');
            $table->string('branch', 64)->default('')->comment('分店');
            $table->string('largeClassify', 32)->default('')->comment('大分类');
            $table->string('smallClassify', 32)->default('')->comment('小分类');
            $table->string('label', 32)->default('')->comment('标签');
            $table->string('topList', 120)->default('')->comment('榜单');
            $table->unsignedInteger('price')->default(0)->comment('消费价格');
            $table->decimal('facilitiesRating', 2, 1)->default(0)->comment('设施评分');
            $table->decimal('environmentRating', 2, 1)->default(0)->comment('环境评分');
            $table->decimal('serviceRating', 2, 1)->default(0)->comment('服务评分');
            $table->decimal('star', 2, 1)->default(0)->comment('星级');
            $table->string('phone', 32)->default('')->comment('电话');
            $table->unsignedInteger('commentNum')->default(0)->comment('评论数');
            $table->unsignedTinyInteger('mallStatus')->default(0)->comment('营业状态 0-未开业 1-已开业');
            $table->string('province', 32)->default('')->comment('省份');
            $table->string('city', 32)->default('')->comment('城市');
            $table->string('district', 32)->default('')->comment('区县');
            $table->string('area', 64)->default('')->comment('区域');
            $table->string('address', 120)->default('')->comment('地址');
            $table->decimal('lng', 7, 6)->default(0)->comment('商场经度');
            $table->decimal('lat', 7, 6)->default(0)->comment('商场纬度');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '全国商场数据';
            $table->index('mallId', 'idxMallId');
            $table->index('city', 'idxCity');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('site_location_mall');
    }
}
